extends Resource


class_name InventoryItem
"""
背包项(数据部分)
"""


signal event_amount_changed(item: InventoryItem)


## 当前堆叠个数
@export var amount: int = 1:
    set(v):
        amount = v
        event_amount_changed.emit(self)
## 关联的背包资源
@export var source: InventoryResource = null


# 剪切下指定数量的道具
func clip(count: int) -> InventoryItem:
    var item: InventoryItem = InventoryItem.new()
    item.amount = count
    item.source = source
    amount -= count
    return item
